package com.jsshse.service.demand.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;


import com.jsshse.service.base.impl.BaseServiceImpl;
import com.jsshse.dao.demand.MeetingDaoI;
import com.jsshse.service.demand.MeetingServiceI;
import com.jsshse.util.MD5;
import com.jsshse.util.Pages;
import com.jsshse.util.CommUtil;

import org.apache.log4j.Logger;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service("meetingService")
public class MeetingServiceImpl extends BaseServiceImpl implements MeetingServiceI{
	private static Logger log = Logger.getLogger(MeetingServiceImpl.class);
	@Resource
	private MeetingDaoI meetingDao ;
	
	@Override
	@CacheEvict(value = "d_meeting", allEntries = true)
	public boolean add(Map map) {
		String id=CommUtil.getId();
		map.put("meeting_id", id);
		return meetingDao.add(map);
	}

	@Override
	@CacheEvict(value = "d_meeting", allEntries = true)
	public boolean delete(String id) {
		return meetingDao.delete(id);
	}

	@Override
	@CacheEvict(value = "d_meeting", allEntries = true)
	public boolean update(Map map) {
		return meetingDao.update(map);

	}

	@Override
	@Cacheable(value = "d_meeting",  key ="'queryById'+#id")
	public Map queryById(String id) {
		return meetingDao.queryById(id);
	}
	

	@Override
	public Pages queryForList(Pages pages) {
		
		pages.setTotal(meetingDao.queryForListCnt(pages.getQueryCondition()));
		List list=meetingDao.queryForListByPage(pages.getAllQueryCond(), pages.getPageStart(), pages.getPageSize());
		pages.setDataList(list);
		return pages;
	}	
}
